<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="./jquery.js"></script>
  <style>
    .btn-gourps {
      position: fixed;
      left: 0;
      top: 20px;
    }
  </style>
</head>

<body>
  <div class="btn-gourps">
    <button id="action">获取高度</button>
  </div>
  <div id="app" style="overflow: auto;"></div>

  <script>
    let s = `
<h3>多个图片，测试图片原生懒加载<h3>

<div>
<img src='https://image.zhangxinxu.com/image/blog/201909/2019-09-29_221742.png'/>
</div>
<div>
<img src='https://image.zhangxinxu.com/image/blog/201909/2019-09-29_221742.png'/>
</div>
<div>
<img src='https://image.zhangxinxu.com/image/blog/201909/2019-09-29_221742.png'/>
</div>
<div>
<img src='https://image.zhangxinxu.com/image/blog/201909/2019-09-29_221742.png'/>
</div>
<div>
<img src='https://image.zhangxinxu.com/image/blog/201909/2019-09-29_221742.png'/>
</div>
<div>
<img src='https://image.zhangxinxu.com/image/blog/201909/2019-09-29_221742.png'/>
</div>
<div>
<img src='https://image.zhangxinxu.com/image/blog/201909/2019-09-29_221742.png'/>
</div>
<div>
<img src='https://image.zhangxinxu.com/image/blog/201909/2019-09-29_221742.png'/>
</div>
<div style='margin: 40px; 0'>加一点间距</div>
<div>
<img src='https://image.zhangxinxu.com/image/blog/201909/2019-09-29_221742.png'/>
</div>
<div>
<img src='https://image.zhangxinxu.com/image/blog/201909/2019-09-29_221742.png'/>
</div>
<div>
<img src='https://image.zhangxinxu.com/image/blog/201909/2019-09-29_221742.png'/>
</div>
<div>
<img src='https://image.zhangxinxu.com/image/blog/201909/2019-09-29_221742.png'/>
</div>
<div>加一点间距</div>
<div>加一点间距</div>
<div>加一点间距</div>
<div>加一点间距</div>
<div>加一点间距</div>
<div>加一点间距</div>
<div>加一点间距</div>
<div>加一点间距</div>
<div>
<img src='https://image.zhangxinxu.com/image/blog/201909/2019-09-29_222745.png'/>
</div>
<div>
<img src='https://image.zhangxinxu.com/image/blog/201909/2019-09-29_222745.png'/>
</div>
<div>
<img src='https://image.zhangxinxu.com/image/blog/201909/2019-09-29_222745.png'/>
</div>

<div>加一点间距</div>
<div>
<img src='https://image.zhangxinxu.com/image/blog/201909/2019-09-29_222745.png'/>
</div>
<div>
<img src='https://image.zhangxinxu.com/image/blog/201909/2019-09-29_222745.png'/>
</div>
<div>
<img src='https://image.zhangxinxu.com/image/blog/201909/2019-09-29_222745.png'/>
</div>
<div>
<img src='https://image.zhangxinxu.com/image/blog/201909/2019-09-29_222745.png'/>
</div>
最后一个文字--贴地
`

    let tempDOM = document.createElement('div')
    let body = document.querySelector('body')
    let app = document.querySelector('#app')
    tempDOM.innerHTML = s

    app.appendChild(tempDOM)

    // -----


    function getH () {
      console.log('原生js',tempDOM.offsetHeight, body.offsetHeight)

      console.log('height---', $('body').height(), $('#app').height())
      console.log('innerHeight---', $('body').innerHeight(), $('#app').innerHeight())
      console.log('outerHeight---', $('body').outerHeight(), $('#app').outerHeight())
      console.log('outerHeight(true)---', $('body').outerHeight(true), $('#app').outerHeight(true))
      console.log('滚动条', $('#app').scrollTop())
    }


    $('#action').click(() => {
      getH()
    })

  </script>
</body>

</html>